#define OFFSET 0x200
#define TIMER_INT 27
#include "typedef.h"
#include "v7r.h"
#include "bitmapapi.h"

typedef volatile struct GlobalTimer
{
    /**
     * @brief counter register, 0x0,0x4 rw
     * 
     */
    word counter0;
    word counter1;
    /**
     * @brief control register, 0x8 rw
     * bit0     : Timer Enable
     * bit1     : Comparater Enable
     * bit2     : IRQ_Enable
     * bit3     : mode  single-shot if 0
     *            mode  auto increment if 1
     * bit15 ~ 8: Prescaler
     * (Prescaler + 1) x (LoadValue + 1) / PeriphCLK
     */
    word control;

    /**
     * @brief interrupt status, 0xc rw
     * bit0     : auto set when counter == comparator
     *            cleared when writeten to 1.
     */
    word int_status;
    /**
     * @brief comparator value, 0x10,0x14 rw
     * 
     */
    word comparator0;
    word comparator1;

    /**
     * @brief auto increment, 0x18 rw
     * 
     */
    word auto_increment;
} *GlobalTimer;

